
for(j in 1:length(days)){
	
	
memo2<-days[j]


stops.new.short$period<-NA
stops.new.short$period[stops.new.short$dayno<memo2]<-"pre-memo"
stops.new.short$period[stops.new.short$dayno>=memo2 ]<-"post-memo"
stops.new.short$period<-factor(stops.new.short$period, levels=c("pre-memo", "post-memo"))


stops.new.short$distance<-NA
stops.new.short$distance<-stops.new.short$dayno-memo2
	
#fix bandwidth at two weeks
m<-lm(weapon.hit~period+distance+period*distance, data=stops.new.short)
results[["loc. linear"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]

m<-lm(weapon.hit~period+distance+period*distance+factor(year)+factor(month)+factor(weekday)+lag.hit, data=stops.new.short)
results[["loc. linear+controls"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]


m<-lm(weapon.hit~period+distance+period*distance + I(distance^2)+period*I(distance^2), data=stops.new.short)
results[["squared"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]

m<-lm(weapon.hit~period+distance+period*distance + I(distance^2)+period*I(distance^2)+factor(year)+factor(month)+factor(weekday)+lag.hit, data=stops.new.short)
results[["squared+controls"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]


m<-lm(weapon.hit~period+distance+period*distance + I(distance^2)+period*I(distance^2) +  I(distance^3)+period*I(distance^3), data=stops.new.short)
results[["cubic"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]


m<-lm(weapon.hit~period+distance+period*distance + I(distance^2)+period*I(distance^2) +  I(distance^3)+period*I(distance^3)+factor(year)+factor(month)+factor(weekday)+lag.hit, data=stops.new.short)
results[["cubic+controls"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]


m<-lm(weapon.hit~period, data=stops.new.short)
results[["diff"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]

m<-lm(weapon.hit~period+factor(year)+factor(month)+factor(weekday)+lag.hit, data=stops.new.short)
results[["diff+controls"]]$coef[j]<-summary(m)$coefficients["periodpost-memo","Estimate"]

if(j%in%c(250, 500, 750, 1000,1200,1500,1800)){
print(j)
save(results, file="data/placebo_all.Rdata")
}

}

